﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Epam.PhotoGallery.Interfaces.Providers;
using Epam.PhotoGallery.Interfaces.DataTransferObjects;

namespace Epam.PhotoGallery.Site.Models
{
    public class Community
    {
        #region Fields

        private ICommunityDataProvider _provider;

        private Community()
        { }

        #endregion

        /// <summary>
        /// Gets the model.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <returns>
        /// Return Community
        /// </returns>
        public static Community GetModel(ICommunityDataProvider provider)
        {
            Community result = new Community();

            result._provider = provider;

            return result;
        }

        public IEnumerable<Category> GetCategories()
        {
            return _provider.GetCategories();
        }

        public Category GetCategory(string categoryID)
        {
            return _provider.GetCategory(categoryID);
        }

        public Topic GetTopic(string categoryID, string topicID)
        {
            return _provider.GetTopic(categoryID, topicID);
        }

        public IEnumerable<BaseTopicInfo> GetBaseTopicsInformation(string categoryID)
        {
            return _provider.GetBaseTopicsInformationFromCategory(categoryID);
        }

        public void AddTopic(Topic newTopic,string categoryID)
        {
            _provider.AddTopic(newTopic, categoryID);
        }

        public void AddComment(Comment newComment, string topicID, string categoryID)
        {
            _provider.AddComment(newComment, topicID, categoryID);
        }

        public void AddCategory(Category newCategory)
        {
            _provider.AddCategory(newCategory);
        }

        public void DeleteTopic(string topicID, string categoryID)
        {
            _provider.DeleteTopic(topicID, categoryID);
        }

        public void DeleteComment(string commentID, string topicID, string categoryID)
        {
            _provider.DeleteComment(commentID, topicID, categoryID);
        }


    }
}